//
//  SwitchViewController.m
//  OCDome
//
//  Created by 李含文 on 2020/10/12.
//  Copyright © 2020 李含文. All rights reserved.
//

#import "SwitchViewController.h"
#import "HWSwitch.h"

@interface SwitchViewController ()

@end

@implementation SwitchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    HWSwitch *s = [[HWSwitch alloc] initWithFrame:CGRectMake(100, 100, 51, 22)];
    [self.view addSubview:s];
    
    // 画圆弧
    CGFloat kViewHeight = 200;
    UIView *showView = [[UIView alloc] initWithFrame:(CGRectMake(0, self.view.frame.size.height-kViewHeight-hw_navHeight, self.view.frame.size.width, kViewHeight))];
    showView.backgroundColor = UIColor.grayColor;
    showView.layer.masksToBounds = YES;
    [self.view addSubview:showView];
    
    UIBezierPath *bezierPath = [UIBezierPath bezierPath];
    //画圆弧 顺时针半圈
    CGFloat kRadius = kViewHeight*3;
    [bezierPath addArcWithCenter:CGPointMake(self.view.frame.size.width/2, kRadius) radius:kRadius startAngle:0 endAngle:-M_PI clockwise:NO];
    [bezierPath closePath];
    //  设置颜色（颜色设置也可以放在最上面，只要在绘制前都可以）
    [UIColor.redColor setStroke];
    [UIColor.systemPinkColor setFill];
    // 描边和填充
    [bezierPath stroke];
    [bezierPath fill];
    
    CAShapeLayer *layer = [CAShapeLayer layer];
    layer.path = bezierPath.CGPath;
    layer.strokeColor = UIColor.redColor.CGColor;
    layer.fillColor = UIColor.greenColor.CGColor;
    layer.backgroundColor = UIColor.systemPinkColor.CGColor;
    [showView.layer addSublayer:layer];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
